<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    /*选择血液成分自动补全*/
    autoCompleteBCom("component");
    function autoCompleteBCom(inputId){
        var url="${ctx}/blood/bloodComponent/autoComplete";
        autoComplete(inputId,url,
            function(data){
                var rows = [];
                for(var i=0; i<data.length; i++){
                    rows[rows.length] = {
                        data:data[i],
                        value:data[i].id,
                        result:data[i].bloodName
                    };
                }
                return rows;
            },function(data, i, max){
                return data.inputCode + ' | '+data.bloodName
            },function(event,data,formatted){
                $('#componentId').attr('value',data.id);
            });
    }
    autoCompleteClinic("clinic");
    function autoCompleteClinic(inputId){
        var url="${ctx}/oper/clinicItemDict/automatic";
        autoComplete(inputId,url,
            function(data){
                var rows = [];
                for(var i=0; i<data.length; i++){
                    rows[rows.length] = {
                        data:data[i],
                        value:data[i].id,
                        result:data[i].itemName
                    };
                }
                return rows;
            },function(data, i, max){
                return data.inputCode + ' | '+data.itemName
            },function(event,data,formatted){
                $('#clinicId').attr('value',data.id);
            });
    }
</script>
<div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
            <ul class="nav nav-tabs">
                <li>
                    <a href="#"  onclick="loadDiv('mainCenterDiv','${ctx}/blood/bloodFeePrice/index')">成分血液对照表列表</a>
                </li>
                <li class="active">
                    <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/blood/bloodFeePrice/form')">
                        <c:choose>
                            <c:when test="${bloodFeePrice.id==''|| bloodFeePrice.id==null}">
                                成分血液对照表添加
                            </c:when>
                            <c:otherwise>成分血液对照表修改</c:otherwise>
                        </c:choose>
                    </a>
                </li>
            </ul>
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="col-lg-12">
                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="bloodFeePrice" onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/blood/bloodFeePrice/save','${ctx}/blood/bloodFeePrice/index');" method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="clinicItemDict.id" id="clinicId"/>
                            <form:hidden path="bloodComponent.id" id="componentId"/>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">血液成分：</label>
                                    <div class="col-sm-4">
                                        <input id="component" htmlEscape="false" class="form-control"  maxlength="64" data-parsley-required="true" value="${bloodFeePrice.bloodComponent.bloodName}"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">诊疗项目：</label>
                                    <div class="col-sm-4">
                                        <input id="clinic" htmlEscape="false" class="form-control"  maxlength="64" data-parsley-required="true" value="${bloodFeePrice.clinicItemDict.itemName}"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">储血量：</label>
                                    <div class="col-sm-4">
                                        <form:input path="bloodCapacity" htmlEscape="false" class="form-control"  maxlength="64" data-parsley-required="true"  data-parsley-type="number"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">划价数量：</label>
                                    <div class="col-sm-4">
                                        <form:input path="priceAmount" htmlEscape="false" class="form-control"  maxlength="64" data-parsley-required="true"  data-parsley-type="number"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">开始时间：</label>
                                    <div class="col-sm-4">
                                        <input name="startDate" readonly required class="form-control Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<fmt:formatDate value="${bloodFeePrice.startDate}" pattern="yyyy-MM-dd"/>" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">备注信息：</label>
                                    <div class="col-sm-4">
                                        <form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="form-control"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">&nbsp;
                                        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="loadDiv('mainCenterDiv','${ctx}/blood/bloodFeePrice/index')">
                                </div>
                            </div>
                        </form:form>
                    </div>

                </div>
            </section>
        </div>
    </div>